home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / client / include / trans.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  3.3 KB  |  133 lines

  1. #ifndef __TRANS_H__
  2. #define __TRANS_H__
  3. /*
  4.  *   $RCSfile: trans.h,v $  
  5.  *   $Revision: 1.1.1.1 $  
  6.  *   $Date: 1996/05/04 21:55:20 $      
  7.  */ 
  8. /**********************************************************************
  9. * EXODUS Database Toolkit Software
  10. * Copyright (c) 1991 Computer Sciences Department, University of
  11. *                    Wisconsin -- Madison
  12. * All Rights Reserved.
  13. *
  14. * Permission to use, copy, modify and distribute this software and its
  15. * documentation is hereby granted, provided that both the copyright
  16. * notice and this permission notice appear in all copies of the
  17. * software, derivative works or modified versions, and any portions
  18. * thereof, and that both notices appear in supporting documentation.
  19. *
  20. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  21. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  22. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  23. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  24. *
  25. * The EXODUS Project Group requests users of this software to return 
  26. * any improvements or extensions that they make to:
  27. *
  28. *   EXODUS Project Group 
  29. *     c/o David J. DeWitt and Michael J. Carey
  30. *   Computer Sciences Department
  31. *   University of Wisconsin -- Madison
  32. *   Madison, WI 53706
  33. *
  34. *     or exodus@cs.wisc.edu
  35. *
  36. * In addition, the EXODUS Project Group requests that users grant the 
  37. * Computer Sciences Department rights to redistribute these changes.
  38. **********************************************************************/
  39.  
  40. #include "trans_states.h"
  41. #include "forward.h"
  42.  
  43. /*
  44.  *    define a list structure for searching for the transaction id
  45.  */
  46. class SERVERTRANSREC {
  47. public:
  48.     TID                tid;
  49.     UONE            serverTransState;    
  50.     SERVERINFO        *serverInfo;    
  51.     TRANSREC        *transRec; /* back ptr to the trans */
  52.     LISTELEMENT        participants; /* for list of  serverinfos in transrec */
  53.     LISTELEMENT        transList; /* for list of transrecs in serverinfo */
  54.  
  55.     void Init();
  56.     void ReInit();
  57.     LISTELEMENT *listlocation(int unique);
  58. }; /* SERVERTRANSREC */
  59.  
  60.  
  61. /*
  62.  *    define the transaction control block
  63.  */
  64. struct    TransRec_s {
  65.  
  66.     LIST        userDescList;
  67.     LIST        pageHashList;
  68.     LIST        bufGroupList;
  69.     LIST        lockHeaderList;
  70.     LIST        participants; /* list of participating server/tid/states */
  71.     int            numParticipants;
  72.     UONE        clientTransState;
  73.     BOOL        abortIfError; /* TRUE ==> sm_* aborts if any error occurs  */
  74.     TID            clientTid;
  75.     SERVERINFO    *coordInfo;
  76.     TID            coordTid;
  77.  
  78. #if MAGIC_CHECKING IS_ENABLED
  79.  
  80.     MAGIC        magic;
  81.  
  82. #endif
  83.  
  84. };
  85.  
  86. #define CLIENT_ABORT_TID(tidptr) {\
  87.     TRANSREC *transRec = findTransRec(tidptr);\
  88.     if (transRec->clientTransState == T_ACTIVE) {\
  89.         transRec->clientTransState = T_ABORT;\
  90.     }\
  91. }
  92.  
  93. #define CLIENT_ABORT_TRANS(transRec)\
  94.     if (transRec->clientTransState == T_ACTIVE) {\
  95.         transRec->clientTransState = T_ABORT;\
  96.     }
  97.  
  98.  
  99. /*
  100.  *    define the transrec structure magic number
  101.  */
  102. #define TRANSREC_MAGIC    0x2ad505f0
  103.  
  104.  
  105. /*
  106.  *    define the magic checking macros
  107.  */
  108. #if MAGIC_CHECKING IS_ENABLED
  109.  
  110.  
  111. #define INIT_TRANSREC_MAGIC(_transRec)                \
  112.                                                     \
  113.     (_transRec)->magic = TRANSREC_MAGIC;
  114.  
  115. #define CHECK_TRANSREC_MAGIC(_transRec)                \
  116.                                                     \
  117.     if ((_transRec)->magic != TRANSREC_MAGIC)    {    \
  118.                                                     \
  119.         SM_ERROR(TYPE_FATAL, esmINTERNAL);            \
  120.     }
  121.  
  122.  
  123. #else
  124.  
  125.  
  126. #define INIT_TRANSREC_MAGIC(_transRec)
  127.  
  128. #define CHECK_TRANSREC_MAGIC(_transRec)
  129.  
  130.  
  131. #endif
  132. #endif __TRANS_H__
  133.